Skip to content

Fix auto-sized parent not accounting for child min-width in canSkipFlex path#56167

Closed
NickGerleman wants to merge 1 commit into
react:mainfrom
NickGerleman:export-D95177338
Closed

Fix auto-sized parent not accounting for child min-width in canSkipFlex path#56167
NickGerleman wants to merge 1 commit into
react:mainfrom
NickGerleman:export-D95177338

Conversation

@NickGerleman

@NickGerleman NickGerleman commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Summary:
When a flex container with auto main-axis is measured with a with a known cross dimensions, the canSkipFlex optimization in justifyMainAxis uses computedFlexBasis directly. This doesn't account for the min & max width constraints, causing the parent to undersize.

I have added a .html test page here to mirror the C++ test I added to confirm that flexbox does respect the min-width constraint. minwidth-test.html

Changelog: [Internal]

X-link: react/yoga#1905

Reviewed By: sammy-SC, adityasharat

Differential Revision: D95177338

Pulled By: NickGerleman

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 20, 2026
@meta-codesync

meta-codesync Bot commented Mar 20, 2026

Copy link
Copy Markdown

@NickGerleman has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95177338.

…ex path

Summary:
When a flex container with auto main-axis is measured with a with a known cross dimensions, the `canSkipFlex` optimization in `justifyMainAxis` uses `computedFlexBasis` directly. This doesn't account for the `min` & `max` width constraints, causing the parent to undersize.


I have added a `.html` test page here to mirror the C++ test I added to confirm that flexbox does respect the min-width constraint. [minwidth-test.html](https://github.com/user-attachments/files/25695677/minwidth-test.html)

Changelog: [Internal]

X-link: react/yoga#1905

Reviewed By: sammy-SC, adityasharat

Differential Revision: D95177338

Pulled By: NickGerleman
@meta-codesync

meta-codesync Bot commented Mar 20, 2026

Copy link
Copy Markdown

@NickGerleman has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95177338.

meta-codesync Bot pushed a commit to react/yoga that referenced this pull request Mar 24, 2026
…ex path (#1905)

Summary:
X-link: react/react-native#56167

When a flex container with auto main-axis is measured with a with a known cross dimensions, the `canSkipFlex` optimization in `justifyMainAxis` uses `computedFlexBasis` directly. This doesn't account for the `min` & `max` width constraints, causing the parent to undersize.

I have added a `.html` test page here to mirror the C++ test I added to confirm that flexbox does respect the min-width constraint. [minwidth-test.html](https://github.com/user-attachments/files/25695677/minwidth-test.html)

Changelog: [Internal]

Pull Request resolved: #1905

Reviewed By: sammy-SC, adityasharat

Differential Revision: D95177338

Pulled By: NickGerleman

fbshipit-source-id: bca0b2089ec01a747e86423c6f00160223e6b764
@meta-codesync meta-codesync Bot closed this in b6387d9 Mar 24, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @jhargreaves-spec in b6387d9

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Mar 24, 2026
@meta-codesync

meta-codesync Bot commented Mar 24, 2026

Copy link
Copy Markdown

@NickGerleman merged this pull request in b6387d9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants